<template>
  <div class="wrapper">
    <swiper :options="swiperOption" v-if="showSwiper">
      <swiper-slide v-for="(item,index) of handleList" :key="index">
        <img class="swiper-img" :src="item">
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  data() {
    return {
      swiperOption: {
        pagination: {
          el: '.swiper-pagination'
        }
      }
    }
  },
  props: {
    list: {
      type: Array,
      default: () => []
    }
  },
  mounted() {
  },
  computed: {
    handleList() {
      let list = []
      this.list.forEach(item => {
        if (item.image) {
          list.push(item.image)
        }
      })
      if (list.length === 0) {
        list = this.list
      }
      return list
    },
    showSwiper() {
      return this.list.length
    }
  },
  methods: {
  }
}
</script>

<style lang="less" scoped>
.wrapper{
  overflow:hidden;
  width:100%;
  height: 0;
  padding-bottom:41.667%;
  background: #fff
}
.swiper-img{
  width:100%;
  height:100%;
}

</style>
